package com.hm.cms.auto;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.hm.handler.request.RequestHandlerInterceptor;

/**
 * @author shishun.wang
 * @date 2016年5月12日 下午9:52:32
 * @version 1.0
 * @describe 
 */
@Configuration
public class WebAppConfig extends WebMvcConfigurerAdapter{
	
	@Autowired
	private RequestHandlerInterceptor sessionHandlerInterceptor;
	
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(sessionHandlerInterceptor).addPathPatterns("/**");//验证登录用户的合法性
		super.addInterceptors(registry);
	}
	
	@Override
	public void addCorsMappings(CorsRegistry registry) {
		registry.addMapping("/**");
//		super.addCorsMappings(registry);
	}
}
